<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@ include file="../include/head.jsp" %>
<%@ include file="../include/top.jsp" %>
<%@ include file="../include/left.jsp" %>

<style type="text/css">
.file-box{ position:relative;width:340px} 
.txt{ height:22px; border:1px solid #cdcdcd; width:180px;} 
.file{ position:absolute; top:2px; right:70px; height:31px; filter:alpha(opacity:0);opacity: 0;width:375px } 
</style>

<div class="main-content">

    <%@ include file="../include/navigate.jsp" %>
    
    <div class="container">

        <c:if test="${error != null }">
            <div class="alert alert-danger alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                <strong>异常:</strong> ${error}
            </div>
        </c:if>
        <c:if test="${msg != null }">
            <div class="alert alert-success alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                <strong>提示:</strong> ${msg}
            </div>
        </c:if>
        <div class="widget-box">
            <div class="widget-box-header">
                <div class="col-sm-6">
                    <div class="title">驱动列表</div>
                </div>
                <div class="col-sm-6" style="text-align:right;">
                	<c:if test="${sessionScope.validUrls.contains('/drivers/add')}">
	                    <div class="btn-group-sm" style="padding:2px;">
							<form action="${pageContext.request.contextPath}/drivers/add" method="post" enctype="multipart/form-data">
								<input type='text' name='textfield' id='textfield' size="50" />
								<input type='button' class='btn' value='浏览...' /> 
								<input type="file" name="fileField" class="file" id="fileField" onchange="document.getElementById('textfield').value=this.value" accept=".jar"/>
								<input type="submit" name="submit" class="btn" value="上传" />
							</form>
	                    </div>
                    </c:if>
				</div>
            </div>
            <div class="widget-box-content" style="padding:15px;">
            
				<%-- <form action="${pageContext.request.contextPath}/servlet/UploadHandleServlet" enctype="multipart/form-data" method="post">
					<input type="file" name="file1">
					<input type="submit" value="上传"></input>
				</form> --%>

				<table class="tableComponent table table-hover" width="100%">
					<tbody>
						<c:forEach items="${jarFiles}" var="jarFile">
							<tr>
								<td>${jarFile}</td>
								<td style="text-align:right;"><button type="button" class="btn btn-danger" onclick="openModal('${pageContext.request.contextPath}/drivers/del?fileName=${jarFile}','删除','确定删除${jarFile}吗？')">删除</button></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>

			</div>
        </div>
    </div>
    
    	<div class="row clearfix">
			<div class="col-md-4"></div>
			<div class="col-md-4">
				<nav>
					<ul class="pagination pagination-sm"></ul>
				</nav>
			</div>
		</div>
    
    <div style="position:fixed;bottom:0px; width:100%;" align="center">
        <%@ include file="../include/footer.jsp" %>
    </div>
</div>

	<script type="text/javascript">
	    $('.pagination').twbsPagination({
	        totalPages: ${totalPage},
	        visiblePages: 5,
	        href: '?page={{number}}'
	    });
	</script>

<%@ include file="../include/bottom.jsp" %>
